# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-backports.shutil_get_terminal_size
_pkgname=backports.shutil_get_terminal_size
pkgver=1.0.0
pkgrel=6
pkgdesc="A backport of the get_terminal_size function from Python 3.3's shutil."
url='https://pypi.org/project/backports.shutil_get_terminal_size/#files'
arch=('any')
license=('MIT')
depends=('python2')
makedepends=('python2-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
        'https://github.com/chrippa/backports.shutil_get_terminal_size/commit/afc5714b.patch')
sha512sums=('b74341c6616f9aace5abcc7fd657fc33801b558b6227c533002ccaf588734490b465a4a27d2bdc8047a385771afdcded610edef832dfa5ef24632f4541729050'
            '2c04dd319380220045e7f7eb3f6d1f687715a47be1c763db70fd0e175f666a2a561eba87a025e49fd8b767c6dcda0b769f2441bdb71aa03c0c7a00d0905bf9c9')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -p1 -i ../afc5714b.patch
}

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  rm "$pkgdir/usr/lib/python2.7/site-packages/backports/__init__.py"*
}

